package com.bank.utils;

import java.io.Serializable;

public class ParamCondition implements Serializable{

	private String keyword; // 查询关键字段1

	private String keyquery; //  查询关键字2

	private Integer cpage = 1; // 当前页

	private Integer pageSize = 4; // 每页显示数量

	private Integer offset; // 起始条数

	@SuppressWarnings("unused")
	private Integer prePage;// 上一页

	@SuppressWarnings("unused")
	private Integer nextPage; // 下一页
	@SuppressWarnings("unused")
	private Integer fistPage;// 首页
	@SuppressWarnings("unused")
	private Integer lastPage;// 尾页
	@SuppressWarnings("unused")
	private Integer totalPage;// 总页数

	private Integer total;// 总条数

	private String pageUrl;

	public String getKeyword() {

		return keyword;

	}

	public void setKeyword(String keyword) {

		this.keyword = keyword;

	}

	public String getKeyquery() {
		return keyquery;
	}

	public void setKeyquery(String keyquery) {
		this.keyquery = keyquery;
	}

	public Integer getCpage() {

		if (this.cpage < 1)
			cpage = 1;
		return cpage;

	}

	public void setCpage(Integer cpage) {

		this.cpage = cpage;

	}

	public Integer getPageSize() {

		return pageSize;

	}

	public void setPageSize(Integer pageSize) {

		this.pageSize = pageSize;

	}

	public Integer getOffset() {

		offset = (getCpage() - 1) * getPageSize();

		return offset;

	}

	public void setOffset(Integer offset) {

		this.offset = offset;

	}

	public Integer getPrePage() {

		return cpage <= 1 ? 1 : cpage - 1;

	}

	public void setPrePage(Integer prePage) {

		this.prePage = prePage	;

	}

	public Integer getNextPage() {

		return cpage >= getTotalPage() ? getTotalPage() : cpage + 1;

	}

	public void setNextPage(Integer nextPage) {

		this.nextPage = nextPage;

	}

	public Integer getFistPage() {

		return 1;

	}

	public void setFistPage(Integer fistPage) {

		this.fistPage = fistPage;

	}

	public Integer getLastPage() {

		return getTotalPage();

	}

	public void setLastPage(Integer lastPage) {

		this.lastPage = lastPage;

	}

	public Integer getTotalPage() {

		return getTotal() % getPageSize() == 0 ? getTotal() / getPageSize() : getTotal() / getPageSize() + 1;

	}

	public void setTotalPage(Integer totalPage) {

		this.totalPage = totalPage;

	}

	public Integer getTotal() {

		return total;

	}

	public void setTotal(Integer total) {

		this.total = total;

	}

	public String getPageUrl() {

		pageUrl = "<a href='javascript:void(0)' onclick='fenye(1)' class='btn btn-link'>首页</a>"

				+ "<a href='javascript:void(0)' onclick='fenye(" + getPrePage() + ")'  class='btn btn-link'>上一页</a>"

				+ "<a href='javascript:void(0)' onclick='fenye(" + getNextPage() + ")'  class='btn btn-link'>下一页</a>"

				+ "<a href='javascript:void(0)' onclick='fenye(" + getLastPage() + ")'  class='btn btn-link'>末页</a>"

				+ " 第" + getCpage() + " / " + getTotalPage() + "页 共" + getTotal() + "条";

		return pageUrl;

	}

	public void setPageUrl(String pageUrl) {

		this.pageUrl = pageUrl;

	}

}
